<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<meta name="Robots" content="all" />
<meta name="Author" content="RickyXu" />
<meta name="Keywords" content="mysite,php,technology" />
<meta name="description" content="我的地盘，听我的">
<link rel="shortcut icon" href="images/icon.ico">
<title>Ricky Online - 时间推算器</title>
</head>
<body>

<?php
date_default_timezone_set('Etc/GMT+3');//设置时区
if($_SERVER["REQUEST_METHOD"] == "POST"){
	$days = fpost('days');
	$hours = fpost('hours');
	$minutes = fpost('minutes');
	$seconds = fpost('seconds');
	$times = $days*24*60*60 + $hours*60*60 + $minutes*60 + $seconds;
	$time_target = time() + $times;
	$days = echozero($days);
	$hours = echozero($hours);
	$minutes = echozero($minutes);
	$seconds = echozero($seconds);
	echo "{$days}天{$hours}小时{$minutes}分{$seconds}秒 后为：<span style=\"font-weight: bold\">" . date("Y年m月d日 H:i:s", $time_target) . "</span>";
	echo "<br/>" . "<a href='/applet/counter/'>返回</a>";
}else{
	echo "请输入时间：<br/><form name='for2' id='for2' method='POST'><input name='days' size='4' />天 <input name='hours' size='4' />小时 <input name='minutes' size='4' />分 <input name='seconds' size='4' />秒 <input type='submit' value='计算'></form>";
}

function fpost($par,$def_value=0)
{
	return isset($_POST[$par])?$_POST[$par]:$def_value;
}
function echozero($val)
{
	return $val ? $val : "0";
}
?>

</body>
</html>